Optimal. Leaf size=60 \[ -\frac {(2 a-b) x}{2 b^2}-\frac {a^{3/2} \text {ArcTan}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{b^2 \sqrt {a+b}}+\frac {\cos (x) \sin (x)}{2 b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3266, 481, 536,
209, 211} \begin {gather*} -\frac {a^{3/2} \text {ArcTan}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{b^2 \sqrt {a+b}}-\frac {x (2 a-b)}{2 b^2}+\frac {\sin (x) \cos (x)}{2 b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 211
Rule 481
Rule 536
Rule 3266
Rubi steps
\begin {align*} \int \frac {\cos ^4(x)}{a+b \cos ^2(x)} \, dx &=-\text {Subst}\left (\int \frac {x^4}{\left (1+x^2\right )^2 \left (a+(a+b) x^2\right )} \, dx,x,\cot (x)\right )\\ &=\frac {\cos (x) \sin (x)}{2 b}-\frac {\text {Subst}\left (\int \frac {a+(-a+b) x^2}{\left (1+x^2\right ) \left (a+(a+b) x^2\right )} \, dx,x,\cot (x)\right )}{2 b}\\ &=\frac {\cos (x) \sin (x)}{2 b}-\frac {a^2 \text {Subst}\left (\int \frac {1}{a+(a+b) x^2} \, dx,x,\cot (x)\right )}{b^2}+\frac {(2 a-b) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (x)\right )}{2 b^2}\\ &=-\frac {(2 a-b) x}{2 b^2}-\frac {a^{3/2} \tan ^{-1}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{b^2 \sqrt {a+b}}+\frac {\cos (x) \sin (x)}{2 b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.14, size = 52, normalized size = 0.87 \begin {gather*} \frac {2 (-2 a+b) x+\frac {4 a^{3/2} \text {ArcTan}\left (\frac {\sqrt {a} \tan (x)}{\sqrt {a+b}}\right )}{\sqrt {a+b}}+b \sin (2 x)}{4 b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 59, normalized size = 0.98
method | result | size |
default | \(-\frac {-\frac {b \tan \left (x \right )}{2 \left (1+\tan ^{2}\left (x \right )\right )}+\frac {\left (2 a -b \right ) \arctan \left (\tan \left (x \right )\right )}{2}}{b^{2}}+\frac {a^{2} \arctan \left (\frac {a \tan \left (x \right )}{\sqrt {\left (a +b \right ) a}}\right )}{b^{2} \sqrt {\left (a +b \right ) a}}\) | \(59\) |
risch | \(-\frac {a x}{b^{2}}+\frac {x}{2 b}-\frac {i {\mathrm e}^{2 i x}}{8 b}+\frac {i {\mathrm e}^{-2 i x}}{8 b}+\frac {\sqrt {-\left (a +b \right ) a}\, a \ln \left ({\mathrm e}^{2 i x}-\frac {2 i \sqrt {-\left (a +b \right ) a}-2 a -b}{b}\right )}{2 \left (a +b \right ) b^{2}}-\frac {\sqrt {-\left (a +b \right ) a}\, a \ln \left ({\mathrm e}^{2 i x}+\frac {2 i \sqrt {-\left (a +b \right ) a}+2 a +b}{b}\right )}{2 \left (a +b \right ) b^{2}}\) | \(132\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.47, size = 54, normalized size = 0.90 \begin {gather*} \frac {a^{2} \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{\sqrt {{\left (a + b\right )} a} b^{2}} - \frac {{\left (2 \, a - b\right )} x}{2 \, b^{2}} + \frac {\tan \left (x\right )}{2 \, {\left (b \tan \left (x\right )^{2} + b\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.46, size = 213, normalized size = 3.55 \begin {gather*} \left [\frac {2 \, b \cos \left (x\right ) \sin \left (x\right ) + a \sqrt {-\frac {a}{a + b}} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, a^{2} + 3 \, a b\right )} \cos \left (x\right )^{2} - 4 \, {\left ({\left (2 \, a^{2} + 3 \, a b + b^{2}\right )} \cos \left (x\right )^{3} - {\left (a^{2} + a b\right )} \cos \left (x\right )\right )} \sqrt {-\frac {a}{a + b}} \sin \left (x\right ) + a^{2}}{b^{2} \cos \left (x\right )^{4} + 2 \, a b \cos \left (x\right )^{2} + a^{2}}\right ) - 2 \, {\left (2 \, a - b\right )} x}{4 \, b^{2}}, \frac {b \cos \left (x\right ) \sin \left (x\right ) - a \sqrt {\frac {a}{a + b}} \arctan \left (\frac {{\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a\right )} \sqrt {\frac {a}{a + b}}}{2 \, a \cos \left (x\right ) \sin \left (x\right )}\right ) - {\left (2 \, a - b\right )} x}{2 \, b^{2}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 72, normalized size = 1.20 \begin {gather*} \frac {{\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {a^{2} + a b}}\right )\right )} a^{2}}{\sqrt {a^{2} + a b} b^{2}} - \frac {{\left (2 \, a - b\right )} x}{2 \, b^{2}} + \frac {\tan \left (x\right )}{2 \, {\left (\tan \left (x\right )^{2} + 1\right )} b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.61, size = 291, normalized size = 4.85 \begin {gather*} -\frac {2\,a^2\,\mathrm {atan}\left (\frac {\sin \left (x\right )}{\cos \left (x\right )}\right )-b^2\,\mathrm {atan}\left (\frac {\sin \left (x\right )}{\cos \left (x\right )}\right )-\frac {b^2\,\sin \left (2\,x\right )}{2}+a\,b\,\mathrm {atan}\left (\frac {\sin \left (x\right )}{\cos \left (x\right )}\right )-\frac {a\,b\,\sin \left (2\,x\right )}{2}+\mathrm {atan}\left (\frac {a\,\sin \left (x\right )\,{\left (-a^4-b\,a^3\right )}^{3/2}\,8{}\mathrm {i}+b\,\sin \left (x\right )\,{\left (-a^4-b\,a^3\right )}^{3/2}\,4{}\mathrm {i}+a^5\,\sin \left (x\right )\,\sqrt {-a^4-b\,a^3}\,8{}\mathrm {i}-a^2\,b^3\,\sin \left (x\right )\,\sqrt {-a^4-b\,a^3}\,2{}\mathrm {i}+a^3\,b^2\,\sin \left (x\right )\,\sqrt {-a^4-b\,a^3}\,1{}\mathrm {i}+a\,b^4\,\sin \left (x\right )\,\sqrt {-a^4-b\,a^3}\,1{}\mathrm {i}+a^4\,b\,\sin \left (x\right )\,\sqrt {-a^4-b\,a^3}\,12{}\mathrm {i}}{3\,\cos \left (x\right )\,a^5\,b^2+5\,\cos \left (x\right )\,a^4\,b^3+\cos \left (x\right )\,a^3\,b^4-\cos \left (x\right )\,a^2\,b^5}\right )\,\sqrt {-a^4-b\,a^3}\,2{}\mathrm {i}}{2\,b^3+2\,a\,b^2} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________